package ch.bfh.abhmcm.SoftwareEngineeringAndDesign.view.mainframe.acceptRFCPanel.acceptRFCPanelSubs.listeners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller.acceptRFC.AcceptFinishRFCThread;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.view.mainframe.acceptRFCPanel.AcceptRFCPanel;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.view.mainframe.acceptRFCPanel.acceptRFCPanelSubs.ShowWorkorderDisplay;

public class AcceptRFCActionListener implements ActionListener {

	private ShowWorkorderDisplay showRFCDisplay;
	private AcceptRFCPanel acceptRFCPanel;
	private AcceptFinishRFCThread acceptRFCThread;
	private String status;

	public AcceptRFCActionListener(ShowWorkorderDisplay showRFCDisplay,
			AcceptRFCPanel acceptRFCPanel, String status) {
		this.acceptRFCPanel = acceptRFCPanel;
		this.showRFCDisplay = showRFCDisplay;
		this.status = status;
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		this.action();
	}

	private void action() {
		this.showRFCDisplay.getProgress().setVisible(true);
		this.acceptRFCThread = new AcceptFinishRFCThread(showRFCDisplay,
				acceptRFCPanel, status);
		this.acceptRFCThread.start();
	}
}
